# coding=utf-8
"""
this is a proxy middleware
from http://219.224.166.3:5010/get/ to get
"""
import requests


class ProxyDownloaderMiddleware(object):


    def get_proxy(self):
        return requests.get("http://219.224.166.3:5010/get/").content

    def parse_request(self, request, spider):
        proxy=self.get_proxy()
        request.meta['proxy'] = 'http://{}'.format(proxy)
